package com.java.excend.test_2;

/**
 * @author luzhikun
 * @date 2020/12/5- 21:22
 */
public class GeomertricTest {
    public static void main(String[] args) {
        GeomertricTest geomertricTest = new GeomertricTest();
        //geomertricTest.equalArea(new Yuan("红色",20,5),new MyRectangle(3,4));
        //geomertricTest.displayGeomertricObject(new Yuan(3));
        //boolean a=geomertricTest.equalArea(new Yuan("红色",20,5),new MyRectangle(3,4));
        //System.out.println("他们的面积："+a);
        GeometricObject c1 = new Circle("红色", 20, 5);
        GeometricObject c2 = new MyRectangle(3, 4);
        boolean a = geomertricTest.equalArea(c1, c2);
        System.out.println("两个图形的面积：" + a);
        geomertricTest.displayGeomertricObject(c1);
        geomertricTest.displayGeomertricObject(c2);
    }

    //判断面积是否相等
    public boolean equalArea(GeometricObject a, GeometricObject b) {
        return (a.findArea() == b.findArea()) ? true : false;
    }

    //输出某图形的面积
    public void displayGeomertricObject(GeometricObject a) {
        System.out.println("面积为：" + a.findArea());
    }
}
